package restaurant.gui.simulation;

import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

/**
 * This JPanel is used to create the GUI for the simulation of the restaurant.
 * 
 * @author Odessa
 */
@SuppressWarnings("serial")
public class SimulationPanel extends JPanel
{

	/**
	 * Creates the panel and the GridBagLayout.
	 */
	public SimulationPanel() {
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] { 182, 182, 86, 0 };
		gridBagLayout.rowHeights = new int[] { 16, 100, 0 };
		gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 0.0,
				Double.MIN_VALUE };
		gridBagLayout.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
		setLayout(gridBagLayout);

		initialize();
	}



	/**
	 * Initializes the panel by adding components to it.
	 */
	private void initialize()
	{
		// Create a label and add to the panel
		JLabel panelNameLabel = new JLabel("Simulation Control");
		panelNameLabel.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));
		panelNameLabel.setHorizontalAlignment(SwingConstants.CENTER);
		GridBagConstraints gbc_panelNameLabel = new GridBagConstraints();
		gbc_panelNameLabel.anchor = GridBagConstraints.NORTH;
		gbc_panelNameLabel.fill = GridBagConstraints.HORIZONTAL;
		gbc_panelNameLabel.insets = new Insets(5, 0, 5, 0);
		gbc_panelNameLabel.gridwidth = 3;
		gbc_panelNameLabel.gridx = 0;
		gbc_panelNameLabel.gridy = 0;
		add(panelNameLabel, gbc_panelNameLabel);

		// Add the variables panel
		GridBagConstraints gbc_variablesPanel = new GridBagConstraints();
		gbc_variablesPanel.fill = GridBagConstraints.HORIZONTAL;
		gbc_variablesPanel.insets = new Insets(0, 0, 0, 5);
		gbc_variablesPanel.gridx = 0;
		gbc_variablesPanel.gridy = 1;
		VariablesPanel variablesPanel = new VariablesPanel();
		add(variablesPanel, gbc_variablesPanel);

		// Add the buttons panel
		GridBagConstraints gbc_buttonsPanel = new GridBagConstraints();
		gbc_buttonsPanel.fill = GridBagConstraints.HORIZONTAL;
		gbc_buttonsPanel.insets = new Insets(0, 0, 0, 5);
		gbc_buttonsPanel.gridx = 1;
		gbc_buttonsPanel.gridy = 1;
		ButtonsPanel buttonsPanel = new ButtonsPanel();
		add(buttonsPanel, gbc_buttonsPanel);

		// Add the clock rate panel
		GridBagConstraints gbc_clockRatPanel = new GridBagConstraints();
		gbc_clockRatPanel.fill = GridBagConstraints.HORIZONTAL;
		gbc_clockRatPanel.gridx = 2;
		gbc_clockRatPanel.gridy = 1;
		ClockRatePanel clockRatePanel = new ClockRatePanel();
		add(clockRatePanel, gbc_clockRatPanel);
	}

}
